package chapter09

/**
  * 异常
  */
object Test01__Exception {
  def main(args: Array[String]): Unit = {
    // 抛出异常
    cul()

    try {
      val a = 10 / 0
    } catch {
      case e: ArithmeticException => {
        println(s"算数异常:${e.getMessage}")
      }
      case e: Exception => println("其它异常")
    } finally {
      println("释放资源")
    }


    @throws[Exception]
    def cul() = {
      val a = 10 / 0
    }
  }

}
